version: '3'
services:
  db:
    container_name: rest-article-db
    image: mysql
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - './docker/db:/var/lib/mysql'
      - './docker/conf/mysql:/etc/mysql/conf.d'
    environment:
      MYSQL_DATABASE: rest-article
      MYSQL_ROOT_PASSWORD: example
    ports:
      - '3306:3306'

  adminer:
    container_name: rest-article-adminer
    image: adminer
    ports:
      - '8080:8080'

  web:
    container_name: rest-article-web
    build:
      context: ./
      dockerfile: docker/web.Dockerfile
    volumes:
      - './:/var/www/html'
      - './docker/php:/usr/local/etc/php/custom.d'
    links:
      - db
    environment:
      XDEBUG_CONFIG: remote_host=host.docker.internal remote_enable=1
      PHP_IDE_CONFIG: serverName=Docker
      PHP_INI_SCAN_DIR: '/usr/local/etc/php/custom.d:/usr/local/etc/php/conf.d'

  nginx:
    container_name: rest-article-nginx
    image: 'nginx:1.17'
    ports:
      - '80:80'
    volumes:
      - './public:/var/www/html'
      - './docker/nginx/nginx.conf:/etc/nginx/nginx.conf'
    depends_on:
      - web

